package praktikumid.w09.p2.interface_example;

/**
 * Abstract class for Vehicle. Described the general Vehicle
 * class, which are extended for the concrete types of vehicles.
 * Abstract class itself cannot be instantiated 
 * (new Vehicle() is not allowed).
 * @author Ago
 *
 */
public abstract class Vehicle {
	/**
	 * Drive method. This is a declaration of an 
	 * abstract method. Every extending class
	 * should implement this method. This is 
	 * technically similar to a method in interface,
	 * where only the declaration of the method
	 * is written. The reason to have abstract
	 * method here can be the need to have different
	 * implementations for different vehicle types.
	 */
	public abstract void drive();
	
	/**
	 * Stop method. As most of the implementations
	 * of the stop method are the same, the implementation
	 * is coded here.
	 */
	public void stop() {
		// speed = 0
	}
	
	/**
	 * Set this vehicle to follow another vehicle.
	 * This is an example, how an argument is general
	 * Vehicle type, but concrete vehicle implementations
	 * can be used instead. So, for example 
	 * car.follow(new Car()) is acceptable. Moreover,
	 * instance of Vehicle itself is not possible.
	 * @param v Which vehicle to follow.
	 */
	public void follow(Vehicle v) {
		//
	}
}
